<?php

namespace App\Library\Requests\ProductOrder;

use App\Library\Requests\Base\BasePageRequest;
use App\Library\Rules\LikeRule;

class ProductOrderPageRequest extends BasePageRequest
{
    public function rules(): array
    {
        return array_merge(parent::rules(), [
            'shopOrderExt.status' => 'nullable|integer|between:0,7',
            $this->No => 'nullable|string|size:20|regex:' . __('com.numReg'),
            'userMobile' => 'nullable|string|size:11|regex:' . __('com.mobileReg'),
            'orderContactsMobile' => 'nullable|string|size:11|regex:' . __('com.mobileReg'),
            'orderId' => 'nullable|integer|min:1',
            'productId' => 'nullable|integer|min:1',
            'orderContacts' => ['nullable', 'string', 'max:30', new LikeRule],
            'expressNo' => ['nullable', 'string', 'max:30', new LikeRule],
            'startAt' => 'nullable|date|date_format:Y-m-d H:i:s',
            'endAt' => 'nullable|date|date_format:Y-m-d H:i:s',
        ]);
    }
}
